#pragma once
#include "Dllexport.h"
#include <windows.h>
#include <memory>
#include <assert.h>
namespace NBGUI
{
	enum ERRORCODE
	{
		InvalidRenderer = 100,
		InvalidWindow,

		InvalidLayout = 200,
		InvalidElementName,
		InvalidElementType,
		UnknownElementType,
		ImagePathTooLong,
		InitFontLibError,
		InitFontFaceError,
		FreeTypeRuntimeError
	};
	class GUIException
	{
	public:
		GUIException(ERRORCODE ec, const wchar_t* _des, bool ext = true):errCode(ec),des (new wchar_t[512]), b_exit(ext)
		{
			wsprintf(des.get(),L"Error code = %d.\n%s",ec,_des);
		}

		void popErrorWindow()
		{
			MessageBox(nullptr,des.get(),L"Error",MB_OK|MB_ICONERROR);
			if(b_exit)
				exit(0);
		}

	private:
		bool b_exit;
		ERRORCODE errCode;
		std::tr1::shared_ptr<wchar_t> des;
	};
}